# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=swayr
pkgver=0.27.1
pkgrel=0
pkgdesc="A window switcher (and more) for Sway"
url="https://sr.ht/~tsdh/swayr/"
arch="all"
license="GPL-3.0-or-later"
makedepends="cargo cargo-auditable"
source="$pkgname-$pkgver.tar.gz::https://git.sr.ht/~tsdh/swayr/archive/swayr-$pkgver.tar.gz"
builddir="$srcdir/$pkgname-swayr-$pkgver"

# secfixes:
#   0.16.1-r0:
#     - CVE-2022-24713

export CARGO_PROFILE_RELEASE_OPT_LEVEL="z"

prepare() {
	default_prepare
	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build -p swayr --release --frozen
}

check() {
	cargo test -p swayr --frozen
}

package() {
	install -D -m755 target/release/swayr -t "$pkgdir"/usr/bin/
	install -D -m755 target/release/swayrd -t "$pkgdir"/usr/bin/
}

sha512sums="
0e82f02e6f9f7d5d768c3c91f576907bfeddab09aa7c9cc88490edc86cc4cf6e2f4c68faaf6c86a589602455e02cf7214aaef91e24a2689b70387de952791fba  swayr-0.27.1.tar.gz
"
